//
//  GYSettingView.m
//  research
//
//  Created by 章鱼 on 17/3/30.
//  Copyright © 2017年 simon. All rights reserved.
//

#import "GYSettingView.h"

@implementation GYSettingView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self  setIconSettingView];
        [self setBackgroundColor:[UIColor whiteColor]];
        self.layer.borderColor = [UIColor orz_stroke].CGColor;
        self.layer.borderWidth = 0.5f;
    }
    return self;
}

- (void)setIconSettingView {
    _icon = [[UIImageView alloc] init];
    _icon.contentMode =  UIViewContentModeScaleAspectFill;
    _icon.autoresizingMask = UIViewAutoresizingFlexibleHeight;
    [self addSubview:_icon];
    
    _wordLable = [[UILabel alloc] init];
    [self addSubview:_wordLable];
    _wordLable.textColor = [UIColor colorWithHex:@"323232" alpha:1];
    _wordLable.font = [UIFont systemFontOfSize:13];
    
    _nextIconButton = [[UIButton alloc] init];
    [self addSubview:_nextIconButton];
    [_nextIconButton setImage:[UIImage imageNamed:@"sttings_button_on"] forState:UIControlStateNormal];
    [_nextIconButton setImage:[UIImage imageNamed:@"sttings_button_off"] forState:UIControlStateSelected];
    
    [_nextIconButton addTarget:self action:@selector(nextIcon:) forControlEvents:UIControlEventTouchUpInside];
    
    _lineView = [[UIView alloc] init];
    [self addSubview:_lineView];
    _lineView.backgroundColor = [UIColor orz_line];
    
    
    [self setUI];
}

- (void)setUI {
    [_icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.left.mas_equalTo(12.f);

    }];
    
    [_wordLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.left.mas_equalTo(54.f);
        
    }];
    
    [_nextIconButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.right.mas_equalTo(-12.f);
        
    }];
    
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(54.f);
        make.right.mas_equalTo(0.f);
        make.bottom.mas_equalTo(0.f);
        make.height.mas_equalTo(0.5f);
        
    }];
}

-(void)nextIcon:(UIButton *)btn {

    btn.selected= !btn.selected;
}

@end
